define([
        	'jquery',
        	'bootstrap',
        	'underscore',
        	'backbone',
        	'text!templates/business/AlarmUserListItem.html',
        	'text!templates/business/AlarmUserList.html'
        ], function($, _bootstrap, _, Backbone, AlarmUserListItemTemplate, AlarmUserListTemplate) {
		var AlarmUserListItemView = Backbone.View.extend({
			tagName : 'tr',
			initialize : function () {
				this.model.bind("change", this.render, this);
			},
			render : function() {
				var compileTemplate = _.template(AlarmUserListItemTemplate, this.model.toJSON());
				this.$el.html(compileTemplate);
				return this;
			}
		});
		var AlarmUserListView = Backbone.View.extend({
			tagName : 'tbody',
			initialize : function() {
			},
			render : function() {
				var t = this;
	            _.each(this.model.models, function(alarmUser) {
	            	t.$el.append(new AlarmUserListItemView({model : alarmUser}).render().el);
	            });
	            return this;
			}
		});
		var AlarmUserGridView = Backbone.View.extend({
			tagName : 'div',
			initialize : function() {
				this.domId = new Date().getTime();
			},
			render : function() {
				var columns = ['用户编号', '用户名称', '用户状态', '地址'];
				var compileTemplate = _.template(AlarmUserListTemplate, {domId : this.domId, columns : columns, name : '用户列表1'});
				this.$el.html(compileTemplate);
				this.$el.find('table:last').append(new AlarmUserListView({model : this.model}).render().el);
				return this;
			}
		});
		return AlarmUserGridView;
});
